layui.use('laydate', function () {
    var laydate = layui.laydate;
    laydate.render({
        elem: '#begintime' //指定元素
        , type: 'datetime'
    });
    laydate.render({
        elem: '#endtime' //指定元素
        , type: 'datetime'
    });
});

layui.use('form', function () {
    var form = layui.form;
    form.on('submit(table_edit_form)', function (data) {
        $.ajax({
            url: "http://" + IPADDRESS + ":" + PORT + "/table/updateTableById/",
            type: "POST",
            contentType: "application/json;charset=utf-8",
            data: JSON.stringify(data.field),
            dataType: "json",
            success: function (data) {
                if (data.header.res_code == '200000') {
                    layer.alert(data.header.message, {
                        icon: 1,
                        title: "提示"
                    });
                    setTimeout(function () {
                            // 获得frame索引
                            var index = parent.layer.getFrameIndex(window.name);
                            //关闭当前frame
                            parent.layer.close(index);
                        }, 800
                    );

                } else {
                    layer.alert(data.header.message, {
                        icon: 5,
                        title: "提示"
                    });
                }
            }
        })
    })
})
